package com.caochenlei.abstractFactory.factory;

import com.caochenlei.abstractFactory.color.Color;
import com.caochenlei.abstractFactory.shape.Shape;

public class AbstractFactoryProducerTest {
    public static void main(String[] args) {
        AbstractFactory shapeFactory = AbstractFactoryProducer.createFactory("Shape");
        Shape rectangle = shapeFactory.createShape("Rectangle");
        rectangle.draw();
        Shape square = shapeFactory.createShape("Square");
        square.draw();
        Shape circle = shapeFactory.createShape("Circle");
        circle.draw();

        AbstractFactory colorFactory = AbstractFactoryProducer.createFactory("Color");
        Color red = colorFactory.createColor("Red");
        red.fill();
        Color green = colorFactory.createColor("Green");
        green.fill();
        Color blue = colorFactory.createColor("Blue");
        blue.fill();
    }
}
